<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="node432.html" />
<link rel="prev" href="curses-functions.html" />
<link rel="parent" href="module-curses.html" />
<link rel="next" href="node432.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>14.7.2 Window Objects </title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="14.7.1 Functions"
  href="curses-functions.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="14.7 curses  "
  href="module-curses.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="14.7.3 Constants"
  href="node432.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="curses-functions.html">14.7.1 Functions</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-curses.html">14.7 curses  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node432.html">14.7.3 Constants</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION0016720000000000000000"></a><a name="curses-window-objects"></a>
<br>
14.7.2 Window Objects 
</h2>

<p>
Window objects, as returned by <tt class="function">initscr()</tt> and
<tt class="function">newwin()</tt> above, have the
following methods:

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3045' xml:id='l2h-3045' class="method">addch</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
<span class="note"><b class="label">Note:</b>
A <em>character</em> means a C character (an
ASCII code), rather then a Python character (a string of length 1).
(This note is true whenever the documentation mentions a character.)
The builtin <tt class="function">ord()</tt> is handy for conveying strings to codes.</span>

<p>
Paint character <var>ch</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
<var>attr</var>, overwriting any character previously painter at that
location.  By default, the character position and attributes are the
current settings for the window object.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3046' xml:id='l2h-3046' class="method">addnstr</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> str, n</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Paint at most <var>n</var> characters of the 
string <var>str</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
<var>attr</var>, overwriting anything previously on the display.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3047' xml:id='l2h-3047' class="method">addstr</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> str</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Paint the string <var>str</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
<var>attr</var>, overwriting anything previously on the display.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3048' xml:id='l2h-3048' class="method">attroff</tt></b>(</nobr></td>
  <td><var>attr</var>)</td></tr></table></dt>
<dd>
Remove attribute <var>attr</var> from the ``background'' set applied to all
writes to the current window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3049' xml:id='l2h-3049' class="method">attron</tt></b>(</nobr></td>
  <td><var>attr</var>)</td></tr></table></dt>
<dd>
Add attribute <var>attr</var> from the ``background'' set applied to all
writes to the current window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3050' xml:id='l2h-3050' class="method">attrset</tt></b>(</nobr></td>
  <td><var>attr</var>)</td></tr></table></dt>
<dd>
Set the ``background'' set of attributes to <var>attr</var>.  This set is
initially 0 (no attributes).
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3051' xml:id='l2h-3051' class="method">bkgd</tt></b>(</nobr></td>
  <td><var>ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Sets the background property of the window to the character <var>ch</var>,
with attributes <var>attr</var>.  The change is then applied to every
character position in that window:

<ul>
<li>The attribute of every character in the window  is
changed to the new background attribute.
</li>
<li>Wherever  the  former background character appears,
it is changed to the new background character.
</li>
</ul>

<p>
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3052' xml:id='l2h-3052' class="method">bkgdset</tt></b>(</nobr></td>
  <td><var>ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Sets the window's background.  A window's background consists of a
character and any combination of attributes.  The attribute part of
the background is combined (OR'ed) with all non-blank characters that
are written into the window.  Both the character and attribute parts
of the background are combined with the blank characters.  The
background becomes a property of the character and moves with the
character through any scrolling and insert/delete line/character
operations.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3053' xml:id='l2h-3053' class="method">border</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>ls</var><big>[</big><var>, rs</var><big>[</big><var>,
                                   ts</var><big>[</big><var>, bs</var><big>[</big><var>, tl</var><big>[</big><var>,
                                   tr</var><big>[</big><var>, bl</var><big>[</big><var>, br</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Draw a border around the edges of the window. Each parameter specifies 
the character to use for a specific part of the border; see the table
below for more details.  The characters can be specified as integers
or as one-character strings.

<p>
<span class="note"><b class="label">Note:</b>
A <code>0</code> value for any parameter will cause the
default character to be used for that parameter.  Keyword parameters
can <em>not</em> be used.  The defaults are listed in this table:</span>

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Parameter</th>
      <th class="left"  >Description</th>
      <th class="left"  >Default value</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline"><var>ls</var></td>
        <td class="left"  >Left side</td>
        <td class="left"  ><tt class="constant">ACS_VLINE</tt></td></tr>
    <tr><td class="left"   valign="baseline"><var>rs</var></td>
        <td class="left"  >Right side</td>
        <td class="left"  ><tt class="constant">ACS_VLINE</tt></td></tr>
    <tr><td class="left"   valign="baseline"><var>ts</var></td>
        <td class="left"  >Top</td>
        <td class="left"  ><tt class="constant">ACS_HLINE</tt></td></tr>
    <tr><td class="left"   valign="baseline"><var>bs</var></td>
        <td class="left"  >Bottom</td>
        <td class="left"  ><tt class="constant">ACS_HLINE</tt></td></tr>
    <tr><td class="left"   valign="baseline"><var>tl</var></td>
        <td class="left"  >Upper-left corner</td>
        <td class="left"  ><tt class="constant">ACS_ULCORNER</tt></td></tr>
    <tr><td class="left"   valign="baseline"><var>tr</var></td>
        <td class="left"  >Upper-right corner</td>
        <td class="left"  ><tt class="constant">ACS_URCORNER</tt></td></tr>
    <tr><td class="left"   valign="baseline"><var>bl</var></td>
        <td class="left"  >Bottom-left corner</td>
        <td class="left"  ><tt class="constant">ACS_LLCORNER</tt></td></tr>
    <tr><td class="left"   valign="baseline"><var>br</var></td>
        <td class="left"  >Bottom-right corner</td>
        <td class="left"  ><tt class="constant">ACS_LRCORNER</tt></td></tr></tbody>
</table></div>
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3054' xml:id='l2h-3054' class="method">box</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>vertch, horch</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Similar to <tt class="method">border()</tt>, but both <var>ls</var> and <var>rs</var> are
<var>vertch</var> and both <var>ts</var> and bs are <var>horch</var>.  The default
corner characters are always used by this function.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3055' xml:id='l2h-3055' class="method">clear</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Like <tt class="method">erase()</tt>, but also causes the whole window to be repainted
upon next call to <tt class="method">refresh()</tt>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3056' xml:id='l2h-3056' class="method">clearok</tt></b>(</nobr></td>
  <td><var>yes</var>)</td></tr></table></dt>
<dd>
If <var>yes</var> is 1, the next call to <tt class="method">refresh()</tt>
will clear the window completely.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3057' xml:id='l2h-3057' class="method">clrtobot</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Erase from cursor to the end of the window: all lines below the cursor
are deleted, and then the equivalent of <tt class="method">clrtoeol()</tt> is performed.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3058' xml:id='l2h-3058' class="method">clrtoeol</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Erase from cursor to the end of the line.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3059' xml:id='l2h-3059' class="method">cursyncup</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Updates the current cursor position of all the ancestors of the window
to reflect the current cursor position of the window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3060' xml:id='l2h-3060' class="method">delch</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Delete any character at <code>(<var>y</var>, <var>x</var>)</code>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3061' xml:id='l2h-3061' class="method">deleteln</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Delete the line under the cursor. All following lines are moved up
by 1 line.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3062' xml:id='l2h-3062' class="method">derwin</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_x</var>)</td></tr></table></dt>
<dd>
An abbreviation for ``derive window'', <tt class="method">derwin()</tt> is the same
as calling <tt class="method">subwin()</tt>, except that <var>begin_y</var> and
<var>begin_x</var> are relative to the origin of the window, rather than
relative to the entire screen.  Returns a window object for the
derived window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3063' xml:id='l2h-3063' class="method">echochar</tt></b>(</nobr></td>
  <td><var>ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Add character <var>ch</var> with attribute <var>attr</var>, and immediately 
call <tt class="method">refresh()</tt> on the window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3064' xml:id='l2h-3064' class="method">enclose</tt></b>(</nobr></td>
  <td><var>y, x</var>)</td></tr></table></dt>
<dd>
Tests whether the given pair of screen-relative character-cell
coordinates are enclosed by the given window, returning true or
false.  It is useful for determining what subset of the screen
windows enclose the location of a mouse event.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3065' xml:id='l2h-3065' class="method">erase</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Clear the window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3066' xml:id='l2h-3066' class="method">getbegyx</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Return a tuple <code>(<var>y</var>, <var>x</var>)</code> of co-ordinates of upper-left
corner.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3067' xml:id='l2h-3067' class="method">getch</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Get a character. Note that the integer returned does <em>not</em> have to
be in ASCII range: function keys, keypad keys and so on return numbers
higher than 256. In no-delay mode, -1 is returned if there is 
no input.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3068' xml:id='l2h-3068' class="method">getkey</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Get a character, returning a string instead of an integer, as
<tt class="method">getch()</tt> does. Function keys, keypad keys and so on return a
multibyte string containing the key name.  In no-delay mode, an
exception is raised if there is no input.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3069' xml:id='l2h-3069' class="method">getmaxyx</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Return a tuple <code>(<var>y</var>, <var>x</var>)</code> of the height and width of
the window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3070' xml:id='l2h-3070' class="method">getparyx</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Returns the beginning coordinates of this window relative to its
parent window into two integer variables y and x.  Returns
<code>-1,-1</code> if this window has no parent.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3071' xml:id='l2h-3071' class="method">getstr</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Read a string from the user, with primitive line editing capacity.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3072' xml:id='l2h-3072' class="method">getyx</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Return a tuple <code>(<var>y</var>, <var>x</var>)</code> of current cursor position 
relative to the window's upper-left corner.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3073' xml:id='l2h-3073' class="method">hline</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> ch, n</var>)</td></tr></table></dt>
<dd>
Display a horizontal line starting at <code>(<var>y</var>, <var>x</var>)</code> with
length <var>n</var> consisting of the character <var>ch</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3074' xml:id='l2h-3074' class="method">idcok</tt></b>(</nobr></td>
  <td><var>flag</var>)</td></tr></table></dt>
<dd>
If <var>flag</var> is false, curses no longer considers using the hardware
insert/delete character feature of the terminal; if <var>flag</var> is
true, use of character insertion and deletion is enabled.  When curses
is first initialized, use of character insert/delete is enabled by
default.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3075' xml:id='l2h-3075' class="method">idlok</tt></b>(</nobr></td>
  <td><var>yes</var>)</td></tr></table></dt>
<dd>
If called with <var>yes</var> equal to 1, <tt class="module">curses</tt> will try and use
hardware line editing facilities. Otherwise, line insertion/deletion
are disabled.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3076' xml:id='l2h-3076' class="method">immedok</tt></b>(</nobr></td>
  <td><var>flag</var>)</td></tr></table></dt>
<dd>
If <var>flag</var> is true, any change in the window image
automatically causes the window to be refreshed; you no longer
have to call <tt class="method">refresh()</tt> yourself.  However, it may
degrade performance considerably, due to repeated calls to
wrefresh.  This option is disabled by default.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3077' xml:id='l2h-3077' class="method">inch</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return the character at the given position in the window. The bottom
8 bits are the character proper, and upper bits are the attributes.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3078' xml:id='l2h-3078' class="method">insch</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> ch</var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Paint character <var>ch</var> at <code>(<var>y</var>, <var>x</var>)</code> with attributes
<var>attr</var>, moving the line from position <var>x</var> right by one
character.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3079' xml:id='l2h-3079' class="method">insdelln</tt></b>(</nobr></td>
  <td><var>nlines</var>)</td></tr></table></dt>
<dd>
Inserts <var>nlines</var> lines into the specified window above the current
line.  The <var>nlines</var> bottom lines are lost.  For negative
<var>nlines</var>, delete <var>nlines</var> lines starting with the one under
the cursor, and move the remaining lines up.  The bottom <var>nlines</var>
lines are cleared.  The current cursor position remains the same.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3080' xml:id='l2h-3080' class="method">insertln</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Insert a blank line under the cursor. All following lines are moved
down by 1 line.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3081' xml:id='l2h-3081' class="method">insnstr</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> str, n </var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Insert a character string (as many characters as will fit on the line)
before the character under the cursor, up to <var>n</var> characters.  
If <var>n</var> is zero or negative,
the entire string is inserted.
All characters to the right of
the cursor are shifted right, with the rightmost characters on the
line being lost.  The cursor position does not change (after moving to
<var>y</var>, <var>x</var>, if specified). 
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3082' xml:id='l2h-3082' class="method">insstr</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x, </var><big>]</big><var> str </var><big>[</big><var>, attr</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Insert a character string (as many characters as will fit on the line)
before the character under the cursor.  All characters to the right of
the cursor are shifted right, with the rightmost characters on the
line being lost.  The cursor position does not change (after moving to
<var>y</var>, <var>x</var>, if specified). 
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3083' xml:id='l2h-3083' class="method">instr</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x</var><big>]</big><var> </var><big>[</big><var>, n</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Returns a string of characters, extracted from the window starting at
the current cursor position, or at <var>y</var>, <var>x</var> if specified.
Attributes are stripped from the characters.  If <var>n</var> is specified,
<tt class="method">instr()</tt> returns return a string at most <var>n</var> characters
long (exclusive of the trailing NUL).
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3084' xml:id='l2h-3084' class="method">is_linetouched</tt></b>(</nobr></td>
  <td><var><var>line</var></var>)</td></tr></table></dt>
<dd>
Returns true if the specified line was modified since the last call to
<tt class="method">refresh()</tt>; otherwise returns false.  Raises a
<tt class="exception">curses.error</tt> exception if <var>line</var> is not valid
for the given window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3085' xml:id='l2h-3085' class="method">is_wintouched</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Returns true if the specified window was modified since the last call to
<tt class="method">refresh()</tt>; otherwise returns false.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3086' xml:id='l2h-3086' class="method">keypad</tt></b>(</nobr></td>
  <td><var>yes</var>)</td></tr></table></dt>
<dd>
If <var>yes</var> is 1, escape sequences generated by some keys (keypad, 
function keys) will be interpreted by <tt class="module">curses</tt>.
If <var>yes</var> is 0, escape sequences will be left as is in the input
stream.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3087' xml:id='l2h-3087' class="method">leaveok</tt></b>(</nobr></td>
  <td><var>yes</var>)</td></tr></table></dt>
<dd>
If <var>yes</var> is 1, cursor is left where it is on update, instead of
being at ``cursor position.''  This reduces cursor movement where
possible. If possible the cursor will be made invisible.

<p>
If <var>yes</var> is 0, cursor will always be at ``cursor position'' after
an update.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3088' xml:id='l2h-3088' class="method">move</tt></b>(</nobr></td>
  <td><var>new_y, new_x</var>)</td></tr></table></dt>
<dd>
Move cursor to <code>(<var>new_y</var>, <var>new_x</var>)</code>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3089' xml:id='l2h-3089' class="method">mvderwin</tt></b>(</nobr></td>
  <td><var>y, x</var>)</td></tr></table></dt>
<dd>
Moves the window inside its parent window.  The screen-relative
parameters of the window are not changed.  This routine is used to
display different parts of the parent window at the same physical
position on the screen.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3090' xml:id='l2h-3090' class="method">mvwin</tt></b>(</nobr></td>
  <td><var>new_y, new_x</var>)</td></tr></table></dt>
<dd>
Move the window so its upper-left corner is at
<code>(<var>new_y</var>, <var>new_x</var>)</code>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3091' xml:id='l2h-3091' class="method">nodelay</tt></b>(</nobr></td>
  <td><var>yes</var>)</td></tr></table></dt>
<dd>
If <var>yes</var> is <code>1</code>, <tt class="method">getch()</tt> will be non-blocking.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3092' xml:id='l2h-3092' class="method">notimeout</tt></b>(</nobr></td>
  <td><var>yes</var>)</td></tr></table></dt>
<dd>
If <var>yes</var> is <code>1</code>, escape sequences will not be timed out.

<p>
If <var>yes</var> is <code>0</code>, after a few milliseconds, an escape sequence
will not be interpreted, and will be left in the input stream as is.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3093' xml:id='l2h-3093' class="method">noutrefresh</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Mark for refresh but wait.  This function updates the data structure
representing the desired state of the window, but does not force
an update of the physical screen.  To accomplish that, call 
<tt class="function">doupdate()</tt>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3094' xml:id='l2h-3094' class="method">overlay</tt></b>(</nobr></td>
  <td><var>destwin</var><big>[</big><var>, sminrow, smincol,
                                    dminrow, dmincol, dmaxrow, dmaxcol</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Overlay the window on top of <var>destwin</var>. The windows need not be
the same size, only the overlapping region is copied. This copy is
non-destructive, which means that the current background character
does not overwrite the old contents of <var>destwin</var>.

<p>
To get fine-grained control over the copied region, the second form
of <tt class="method">overlay()</tt> can be used. <var>sminrow</var> and <var>smincol</var> are
the upper-left coordinates of the source window, and the other variables
mark a rectangle in the destination window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3095' xml:id='l2h-3095' class="method">overwrite</tt></b>(</nobr></td>
  <td><var>destwin</var><big>[</big><var>, sminrow, smincol,
                                      dminrow, dmincol, dmaxrow, dmaxcol</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Overwrite the window on top of <var>destwin</var>. The windows need not be
the same size, in which case only the overlapping region is
copied. This copy is destructive, which means that the current
background character overwrites the old contents of <var>destwin</var>.

<p>
To get fine-grained control over the copied region, the second form
of <tt class="method">overwrite()</tt> can be used. <var>sminrow</var> and <var>smincol</var> are
the upper-left coordinates of the source window, the other variables
mark a rectangle in the destination window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3096' xml:id='l2h-3096' class="method">putwin</tt></b>(</nobr></td>
  <td><var>file</var>)</td></tr></table></dt>
<dd>
Writes all data associated with the window into the provided file
object.  This information can be later retrieved using the
<tt class="function">getwin()</tt> function.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3097' xml:id='l2h-3097' class="method">redrawln</tt></b>(</nobr></td>
  <td><var>beg, num</var>)</td></tr></table></dt>
<dd>
Indicates that the <var>num</var> screen lines, starting at line <var>beg</var>,
are corrupted and should be completely redrawn on the next
<tt class="method">refresh()</tt> call.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3098' xml:id='l2h-3098' class="method">redrawwin</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Touches the entire window, causing it to be completely redrawn on the
next <tt class="method">refresh()</tt> call.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3099' xml:id='l2h-3099' class="method">refresh</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>pminrow, pmincol, sminrow,
                                    smincol, smaxrow, smaxcol</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Update the display immediately (sync actual screen with previous
drawing/deleting methods).

<p>
The 6 optional arguments can only be specified when the window is a
pad created with <tt class="function">newpad()</tt>.  The additional parameters are
needed to indicate what part of the pad and screen are involved.
<var>pminrow</var> and <var>pmincol</var> specify the upper left-hand corner of the
rectangle to be displayed in the pad.  <var>sminrow</var>, <var>smincol</var>,
<var>smaxrow</var>, and <var>smaxcol</var> specify the edges of the rectangle to
be displayed on the screen.  The lower right-hand corner of the
rectangle to be displayed in the pad is calculated from the screen
coordinates, since the rectangles must be the same size.  Both
rectangles must be entirely contained within their respective
structures.  Negative values of <var>pminrow</var>, <var>pmincol</var>,
<var>sminrow</var>, or <var>smincol</var> are treated as if they were zero.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3100' xml:id='l2h-3100' class="method">scroll</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>lines<code> = 1</code></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Scroll the screen or scrolling region upward by <var>lines</var> lines.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3101' xml:id='l2h-3101' class="method">scrollok</tt></b>(</nobr></td>
  <td><var>flag</var>)</td></tr></table></dt>
<dd>
Controls what happens when the cursor of a window is moved off the
edge of the window or scrolling region, either as a result of a
newline action on the bottom line, or typing the last character
of the last line.  If <var>flag</var> is false, the cursor is left
on the bottom line.  If <var>flag</var> is true, the window is
scrolled up one line.  Note that in order to get the physical
scrolling effect on the terminal, it is also necessary to call
<tt class="method">idlok()</tt>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3102' xml:id='l2h-3102' class="method">setscrreg</tt></b>(</nobr></td>
  <td><var>top, bottom</var>)</td></tr></table></dt>
<dd>
Set the scrolling region from line <var>top</var> to line <var>bottom</var>. All
scrolling actions will take place in this region.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3103' xml:id='l2h-3103' class="method">standend</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Turn off the standout attribute.  On some terminals this has the
side effect of turning off all attributes.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3104' xml:id='l2h-3104' class="method">standout</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Turn on attribute <var>A_STANDOUT</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3105' xml:id='l2h-3105' class="method">subpad</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_x</var>)</td></tr></table></dt>
<dd>
Return a sub-window, whose upper-left corner is at
<code>(<var>begin_y</var>, <var>begin_x</var>)</code>, and whose width/height is
<var>ncols</var>/<var>nlines</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3106' xml:id='l2h-3106' class="method">subwin</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>nlines, ncols,</var><big>]</big><var> begin_y, begin_x</var>)</td></tr></table></dt>
<dd>
Return a sub-window, whose upper-left corner is at
<code>(<var>begin_y</var>, <var>begin_x</var>)</code>, and whose width/height is
<var>ncols</var>/<var>nlines</var>.

<p>
By default, the sub-window will extend from the
specified position to the lower right corner of the window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3107' xml:id='l2h-3107' class="method">syncdown</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Touches each location in the window that has been touched in any of
its ancestor windows.  This routine is called by <tt class="method">refresh()</tt>,
so it should almost never be necessary to call it manually.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3108' xml:id='l2h-3108' class="method">syncok</tt></b>(</nobr></td>
  <td><var>flag</var>)</td></tr></table></dt>
<dd>
If called with <var>flag</var> set to true, then <tt class="method">syncup()</tt> is
called automatically whenever there is a change in the window.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3109' xml:id='l2h-3109' class="method">syncup</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Touches all locations in ancestors of the window that have been changed in 
the window.  
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3110' xml:id='l2h-3110' class="method">timeout</tt></b>(</nobr></td>
  <td><var>delay</var>)</td></tr></table></dt>
<dd>
Sets blocking or non-blocking read behavior for the window.  If
<var>delay</var> is negative, blocking read is used (which will wait
indefinitely for input).  If <var>delay</var> is zero, then non-blocking
read is used, and -1 will be returned by <tt class="method">getch()</tt> if no input
is waiting.  If <var>delay</var> is positive, then <tt class="method">getch()</tt> will
block for <var>delay</var> milliseconds, and return -1 if there is still no
input at the end of that time.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3111' xml:id='l2h-3111' class="method">touchline</tt></b>(</nobr></td>
  <td><var>start, count</var><big>[</big><var>, changed</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Pretend <var>count</var> lines have been changed, starting with line
<var>start</var>.  If <var>changed</var> is supplied, it specifies
whether the affected lines are marked as 
having been changed (<var>changed</var>=1) or unchanged (<var>changed</var>=0).
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3112' xml:id='l2h-3112' class="method">touchwin</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Pretend the whole window has been changed, for purposes of drawing
optimizations.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3113' xml:id='l2h-3113' class="method">untouchwin</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Marks all lines in  the  window  as unchanged since the last call to
<tt class="method">refresh()</tt>. 
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-3114' xml:id='l2h-3114' class="method">vline</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>y, x,</var><big>]</big><var> ch, n</var>)</td></tr></table></dt>
<dd>
Display a vertical line starting at <code>(<var>y</var>, <var>x</var>)</code> with
length <var>n</var> consisting of the character <var>ch</var>.
</dl>

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="14.7.1 Functions"
  href="curses-functions.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="14.7 curses  "
  href="module-curses.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="14.7.3 Constants"
  href="node432.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="curses-functions.html">14.7.1 Functions</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-curses.html">14.7 curses  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node432.html">14.7.3 Constants</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
